﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Sys_Param_Setting.aspx.cs"
    Inherits="SYS_POPEDOM_Sys_Param_Setting" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script type="text/javascript" src="../JavaScript/Common.js"></script>
    <script type="text/javascript">
        function OnSave() {
            var nLength = GridPanel1.store.data.items.length;
            for (var i = 0; i < nLength; i++) {
                Ext.net.DirectMethods.UpdateParmValue(GridPanel1.store.data.items[i].data.PARAMETER_ID, GridPanel1.store.data.items[i].data.DEPT_ID, GridPanel1.store.data.items[i].data.PARAMETER_STR);
            }
            Ext.Msg.alert('系统提示', "保存成功！");
        }
       
    </script>

</head>
<body>
    <form id="form1" runat="server">
    <div>
        <ext:ResourceManager ID="ScriptManager1" runat="server">
        </ext:ResourceManager>
        <ext:Store ID="Store1" runat="server" AutoLoad="true" >
            <Reader>
                <ext:JsonReader>
                    <Fields>
                        <ext:RecordField Name="PARAMETER_ID">
                        </ext:RecordField>
                        <ext:RecordField Name="DEPT_ID">
                        </ext:RecordField>
                        <ext:RecordField Name="ALLOWMODIFY">
                        </ext:RecordField>
                        <ext:RecordField Name="PARAMETER_NOTE">
                        </ext:RecordField>
                        <ext:RecordField Name="DEPT_NAME">
                        </ext:RecordField>
                        <ext:RecordField Name="PARAMETER_STR">
                        </ext:RecordField>
                        <ext:RecordField Name="PARAMETER_TYPE">
                        </ext:RecordField>
                         <ext:RecordField Name="PARAMETER_NAME">
                         </ext:RecordField>
                        <ext:RecordField Name="PARAMETER_TYPE_NAME">
                        </ext:RecordField>
                        
                    </Fields>
                </ext:JsonReader>
            </Reader>
            <%--<Listeners><Load  Handler="#{GridPanel1}.getSelectionModel().selectFirstRow();" /></Listeners>--%>
            <SortInfo Direction="ASC"></SortInfo>
        </ext:Store>
        <ext:viewport ID="Viewport1" runat="server" HideBorders="true">
            <Content>
                <ext:BorderLayout ID = "BorderLayout2" runat ="server">
                <Center>
                <ext:Panel ID = "Panel101" Cls="tool-form" runat = "server"  BodyBorder ="false" BodyStyle="border-width:0 0 0 0;padding:0 0 0 0;" >
                        <Content>
                <ext:RowLayout ID="RowLayout1" runat="server" Split="false"><Rows>
                    <ext:LayoutRow RowHeight="0.5">
                        <ext:Panel ID="Panel1" runat="server" Border="false" Layout="FitLayout">
                            <Content>
                                <%--<ext:FitLayout runat="server">--%>
                                    <ext:GridPanel ID="GridPanel1" runat="server" StoreID="Store1" Border="false" Title="参数列表" BodyStyle=" border-width:0 0 1 0" Layout="Fit">
                                        <ColumnModel>
                                            <Columns>
                                                <ext:RowNumbererColumn Header="序号" Width="35">
                                                </ext:RowNumbererColumn>
                                                <ext:Column Header="DEPT_ID" DataIndex="DEPT_ID" Width="150" Hidden="true">
                                                </ext:Column>
                                                <ext:Column Header="PARAMETER_ID" DataIndex="PARAMETER_ID" Width="150" Hidden="true">
                                                </ext:Column>
                                                <ext:Column Header="参数说明" DataIndex="PARAMETER_NOTE" Width="65" Hidden="true">
                                                </ext:Column>
                                                <ext:Column Header="参数类型" DataIndex="PARAMETER_TYPE" Width="65" Hidden="true">
                                                </ext:Column>
                                                 <ext:Column Header="参数名称" DataIndex="PARAMETER_NAME" Width="200">
                                                </ext:Column>
                                                <ext:Column Header="管理部门" DataIndex="DEPT_NAME" Width="200">
                                                </ext:Column>
                                                 <ext:Column Header="参数类型" DataIndex="PARAMETER_TYPE_NAME" Width="200">
                                                </ext:Column>
                                                <ext:Column Header="当前值" DataIndex="PARAMETER_STR" Width="200">
                                                </ext:Column>
                                                <ext:Column Header="允许设置" DataIndex="ALLOWMODIFY" Width="65">
                                                </ext:Column>
                                            </Columns>
                                        </ColumnModel>
                                        <SelectionModel>
                                            <ext:RowSelectionModel ID="RowSelectionModel1" runat="server">
                                             <SelectedRows>
                                                    <ext:SelectedRow RowIndex="0" />
                                                </SelectedRows>
                                                <DirectEvents>
                                                
                                                    <RowSelect OnEvent="OnGridRowSelect">
                                                        <ExtraParams>
                                                            <ext:Parameter Name="ContainerWidth" Value="Ext.getCmp('Panel2').getWidth()">
                                                            </ext:Parameter>
                                                            <ext:Parameter Name="ContainerHeight" Value="Ext.getCmp('pnlNote').getHeight()">
                                                            </ext:Parameter>
                                                            <ext:Parameter Name="ParamNote" Value="#{GridPanel1}.selModel.getSelected().get('PARAMETER_NOTE')"
                                                                Mode="Raw">
                                                            </ext:Parameter>
                                                            <ext:Parameter Name="paramType" Value="#{GridPanel1}.selModel.getSelected().get('PARAMETER_TYPE')"
                                                                Mode="Raw">
                                                            </ext:Parameter>
                                                            <ext:Parameter Name="PARAMETER_STR" Value="#{GridPanel1}.selModel.getSelected().get('PARAMETER_STR')"
                                                                Mode="Raw">
                                                            </ext:Parameter>
                                                            <ext:Parameter Name="ALLOWMODIFY" Value="#{GridPanel1}.selModel.getSelected().get('ALLOWMODIFY')"
                                                                Mode="Raw">
                                                            </ext:Parameter>
                                                            <ext:Parameter Name="PARAMETER_ID" Value="#{GridPanel1}.selModel.getSelected().get('PARAMETER_ID')"
                                                                Mode="Raw">
                                                            </ext:Parameter>
                                                            <ext:Parameter Name="DEPT_ID" Value="#{GridPanel1}.selModel.getSelected().get('DEPT_ID')"
                                                                Mode="Raw">
                                                            </ext:Parameter>
                                                           <ext:Parameter Name="rowindex"  Value="#{GridPanel1}.selModel.getSelected().get('DEPT_ID')"
                                                                Mode="Raw">
                                                            </ext:Parameter>
                                                        </ExtraParams>
                                                    </RowSelect>
                                                </DirectEvents>
                                            </ext:RowSelectionModel>
                                        </SelectionModel>
                                        <TopBar>
                                            <ext:Toolbar runat="server">
                                                <Items>
                                                    <ext:Button ID="extBtnSave" runat="server" Icon="Accept" Text="保存">
                                                        <Listeners>
                                                            <Click Fn="OnSave" />
                                                        </Listeners>
                                                    </ext:Button>
                                                    <ext:Button ID="extBtnClose" runat="server" Icon="Cancel" Text=" 关闭">
                                                        <Listeners>
                                                            <Click Fn="closeTab" />
                                                        </Listeners>
                                                    </ext:Button>
                                                </Items>
                                            </ext:Toolbar>
                                        </TopBar>
                                      
                                    </ext:GridPanel>
                                <%--</ext:FitLayout>--%>
                            </Content>
                        </ext:Panel>
                    </ext:LayoutRow>
                    <ext:LayoutRow RowHeight="0.5">
                        <ext:Panel ID="Panel2" runat="server" Border="false">
                            <Content>
                                <%--<ext:FitLayout ID="FitLayout2" runat="server">--%>
                                    <ext:Panel ID="Panel3" runat="server" Border="false" Title="参数设置" Frame="false" Layout="FitLayout">
                                        <Content>
                                            <ext:RowLayout ID="RowLayout2" runat="server"><Rows>
                                                <ext:LayoutRow RowHeight="0.5">
                                                    <ext:Panel ID="pnlParam" runat="server" Border="false" BodyStyle="padding:1 1 1 1;" >
                                                        <Content>
                                                        </Content>
                                                    </ext:Panel>
                                                </ext:LayoutRow>
                                                <ext:LayoutRow RowHeight="0.5">
                                                    <ext:Panel ID="pnlNote" runat="server" Border="false" Height="100">
                                                        <Content>
                                                        </Content>
                                                    </ext:Panel>
                                                </ext:LayoutRow></Rows>
                                            </ext:RowLayout>
                                        </Content>
                                    </ext:Panel>
                                <%--</ext:FitLayout>--%>
                            </Content>
                        </ext:Panel>
                    </ext:LayoutRow>
                    </Rows>
                </ext:RowLayout>
                </Content>
                    </ext:Panel>
                </Center>
            </ext:BorderLayout>
            </Content>
        </ext:viewport>
    </div>
    </form>
</body>
</html>
